﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Sys.WebRes.Data;

namespace Sys.WebRes.Publish.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewData["Message"] = "欢迎使用 ASP.NET MVC!";

            using (ResourceSysEntities db = new ResourceSysEntities())
            {
                //var res = db.Resource.Select(p => new { Res = p, User=p.Creator }).FirstOrDefault();
                //ViewData["Message"] += res.User.NickName + res.User.OwnResource.FirstOrDefault().Name;

                //var resource = db.Resource.FirstOrDefault();
                //ViewData["Message"] += "==>" + resource.Creator.NickName;
            }

            return this.RedirectToAction("Index", new { area = "Admin", controller = "Home" });
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
